<template>
	<view>
		<view class="example-info">账号： {{ userInfo.account }}</view>
		<view class="example-info">名称： {{ userInfo.name }}</view>
		<view class="example-info">手机号： {{ userInfo.phone }}</view>
		<view class="example-info">邮箱号： {{ userInfo.email }}</view>
		<view class="example-info">地址： {{ userInfo.address }}</view>
		<view class="example-info">身份证号： {{ userInfo.email }}</view>
		<view class="example-info">性别： {{ userInfo.sex1 }}</view>
		<view class="example-info">业主类型： {{ userInfo.type1 }}</view>
		<view class="uni-padding-wrap uni-common-mt">
			<button type="primary" @click="editInfo">编辑信息</button>
		</view>
	</view>
</template>

<script>
	import uniList from '@/components/uni-list/uni-list'
	import uniListItem from '@/components/uni-list-item/uni-list-item'
	export default {
		components: {
			uniList,
			uniListItem
		},
		data() {
			return {
				userInfo: ''
			}
		},
		onLoad() {
			let params = {
				page: 1,
				limit: 10,
			};
			this.init(params);
		},
		methods: {
			init(params) {
				params.id = uni.getStorageSync('user').id
				params.type = 2
				this.$api.getPersonalInformation(params).then((res) => {
					res.rows.map(item => {
						if (item.etype == 0) {
							item.type1 = '业主'
						} else if (item.etype == 1) {
							item.type1 = '租客'
						} else if (item.etype == 2) {
							item.type1 = '其他'
						}
						if (item.sex == 0) {
							item.sex1 = '男'
						} else if (item.sex == 1) {
							item.sex1 = '女'
						}
					})
					this.userInfo = res.rows[0]
					console.log(this.userInfo)
				}).catch((err) => {
					console.log('request fail', err);
				})
			},
			editInfo() {
				uni.navigateTo({
					url: "editInfo"
				})
			}
		}
	}
</script>

<style>
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #efeff4
	}

	view {
		font-size: 28upx;
		line-height: inherit
	}

	.example {
		padding: 0 30upx 30upx
	}

	.example-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 32upx;
		color: #464e52;
		padding: 30upx 30upx 30upx 50upx;
		margin-top: 20upx;
		position: relative;
		background-color: #fdfdfd;
		border-bottom: 1px #f5f5f5 solid
	}

	.example-title__after {
		position: relative;
		color: #031e3c
	}

	.example-title:after {
		content: '';
		position: absolute;
		left: 30upx;
		margin: auto;
		top: 0;
		bottom: 0;
		width: 6upx;
		height: 32upx;
		background-color: #ccc
	}

	.example .example-title {
		margin: 40upx 0
	}

	.example-body {
		padding: 30upx;
		background: #fff
	}

	.example-info {
		padding: 30upx;
		color: #3b4144;
		background: #fff
	}
</style>